/*
 *  table.c
 *
 *  Created on: 2010-5-12
 *      Author: liuyond
 */
#include "cpu.h"
#include <stdio.h>
#include <stdlib.h>

extern void PUSH_RX(cpu_t *, instruction_t *);
extern void PUSH_ES(cpu_t *, instruction_t *);
extern void PUSH_SS(cpu_t *, instruction_t *);
extern void PUSH_CS(cpu_t *, instruction_t *);
extern void PUSH_DS(cpu_t *, instruction_t *);
extern void PUSH_Ev(cpu_t *, instruction_t *);
extern void POP_RX(cpu_t *, instruction_t *);
extern void POP_ES(cpu_t *, instruction_t *);
extern void POP_DS(cpu_t *, instruction_t *);
extern void POP_SS(cpu_t *, instruction_t *);
extern void POP_Ev(cpu_t *, instruction_t *);

extern void PUSHF(cpu_t *, instruction_t *);
extern void POPF(cpu_t *cpu, instruction_t *);
extern void SAHF(cpu_t *cpu, instruction_t *);
extern void LAHF(cpu_t *cpu, instruction_t *);

extern void MOV_Eb_Gb(cpu_t *, instruction_t *);
extern void MOV_Ev_Gv(cpu_t *, instruction_t *);
extern void MOV_Gb_Eb(cpu_t *, instruction_t *);
extern void MOV_Gv_Ev(cpu_t *, instruction_t *);
extern void MOV_Ew_Sw(cpu_t *, instruction_t *);
extern void MOV_Sw_Ew(cpu_t *, instruction_t *);
extern void MOV_RL_Ib(cpu_t *, instruction_t *);
extern void MOV_RX_Iv(cpu_t *, instruction_t *);
extern void MOV_AL_Ob(cpu_t *, instruction_t *);
extern void MOV_AX_Ov(cpu_t *, instruction_t *);
extern void MOV_Ob_AL(cpu_t *, instruction_t *);
extern void MOV_Ov_AX(cpu_t *, instruction_t *);
extern void MOV_Eb_Ib(cpu_t *, instruction_t *);
extern void MOV_Ev_Iv(cpu_t *, instruction_t *);
extern void LEA_Gv_Mv(cpu_t *, instruction_t *);
extern void LDS_Gv_Mp(cpu_t *, instruction_t *);
extern void LES_Gv_Mp(cpu_t *, instruction_t *);
extern void XCHG_RX_AX(cpu_t *, instruction_t *);
extern void XCHG_Gb_Eb(cpu_t *, instruction_t *);
extern void XCHG_Gv_Ev(cpu_t *, instruction_t *);

extern void ADD_Eb_Gb(cpu_t *, instruction_t *);
extern void ADD_Ev_Gv(cpu_t *, instruction_t *);
extern void ADD_Gb_Eb(cpu_t *, instruction_t *);
extern void ADD_Gv_Ev(cpu_t *, instruction_t *);
extern void ADD_AL_Ib(cpu_t *, instruction_t *);
extern void ADD_AX_Iv(cpu_t *, instruction_t *);
extern void ADC_Eb_Gb(cpu_t *, instruction_t *);
extern void ADC_Ev_Gv(cpu_t *, instruction_t *);
extern void ADC_Gb_Eb(cpu_t *, instruction_t *);
extern void ADC_Gv_Ev(cpu_t *, instruction_t *);
extern void ADC_AL_Ib(cpu_t *, instruction_t *);
extern void ADC_AX_Iv(cpu_t *, instruction_t *);
extern void SUB_Eb_Gb(cpu_t *, instruction_t *);
extern void SUB_Ev_Gv(cpu_t *, instruction_t *);
extern void SUB_Gb_Eb(cpu_t *, instruction_t *);
extern void SUB_Gv_Ev(cpu_t *, instruction_t *);
extern void SUB_AL_Ib(cpu_t *, instruction_t *);
extern void SUB_AX_Iv(cpu_t *, instruction_t *);
extern void SBB_Eb_Gb(cpu_t *, instruction_t *);
extern void SBB_Ev_Gv(cpu_t *, instruction_t *);
extern void SBB_Gb_Eb(cpu_t *, instruction_t *);
extern void SBB_Gv_Ev(cpu_t *, instruction_t *);
extern void SBB_AL_Ib(cpu_t *, instruction_t *);
extern void SBB_AX_Iv(cpu_t *, instruction_t *);
extern void CMP_Eb_Gb(cpu_t *, instruction_t *);
extern void CMP_Ev_Gv(cpu_t *, instruction_t *);
extern void CMP_Gb_Eb(cpu_t *, instruction_t *);
extern void CMP_Gv_Ev(cpu_t *, instruction_t *);
extern void CMP_AL_Ib(cpu_t *, instruction_t *);
extern void CMP_AX_Iv(cpu_t *, instruction_t *);
extern void INC_RX(cpu_t *cpu, instruction_t *i);
extern void DEC_RX(cpu_t *cpu, instruction_t *i);

extern void DAA(cpu_t *cpu, instruction_t *i);
extern void DAS(cpu_t *cpu, instruction_t *i);
extern void AAA(cpu_t *cpu, instruction_t *i);
extern void AAS(cpu_t *cpu, instruction_t *i);
extern void CBW(cpu_t *cpu, instruction_t *i);
extern void CWD(cpu_t *cpu, instruction_t *i);
extern void WAIT(cpu_t *cpu, instruction_t *i);
extern void XLAT(cpu_t *cpu, instruction_t *i);
extern void AAM_Ib(cpu_t *cpu, instruction_t *i);
extern void AAD_Ib(cpu_t *cpu, instruction_t *i);

extern void AND_Eb_Gb(cpu_t *, instruction_t *);
extern void AND_Ev_Gv(cpu_t *, instruction_t *);
extern void AND_Gb_Eb(cpu_t *, instruction_t *);
extern void AND_Gv_Ev(cpu_t *, instruction_t *);
extern void AND_AL_Ib(cpu_t *, instruction_t *);
extern void AND_AX_Iv(cpu_t *, instruction_t *);
extern void XOR_Eb_Gb(cpu_t *, instruction_t *);
extern void XOR_Ev_Gv(cpu_t *, instruction_t *);
extern void XOR_Gb_Eb(cpu_t *, instruction_t *);
extern void XOR_Gv_Ev(cpu_t *, instruction_t *);
extern void XOR_AL_Ib(cpu_t *, instruction_t *);
extern void XOR_AX_Iv(cpu_t *, instruction_t *);
extern void OR_Eb_Gb(cpu_t *, instruction_t *);
extern void OR_Ev_Gv(cpu_t *, instruction_t *);
extern void OR_Gb_Eb(cpu_t *, instruction_t *);
extern void OR_Gv_Ev(cpu_t *, instruction_t *);
extern void OR_AL_Ib(cpu_t *, instruction_t *);
extern void OR_AX_Iv(cpu_t *, instruction_t *);
extern void TEST_Gb_Eb(cpu_t *, instruction_t *);
extern void TEST_Gv_Ev(cpu_t *, instruction_t *);
extern void TEST_Eb_Ib(cpu_t *, instruction_t *);
extern void TEST_Ev_Iv(cpu_t *, instruction_t *);
extern void TEST_AL_Ib(cpu_t *, instruction_t *);
extern void TEST_AX_Iv(cpu_t *, instruction_t *);

extern void MOVSB(cpu_t *cpu, instruction_t *i);
extern void MOVSW(cpu_t *cpu, instruction_t *i);
extern void CMPSB(cpu_t *cpu, instruction_t *i);
extern void CMPSW(cpu_t *cpu, instruction_t *i);
extern void SCASB(cpu_t *cpu, instruction_t *i);
extern void SCASW(cpu_t *cpu, instruction_t *i);
extern void STOSB(cpu_t *cpu, instruction_t *i);
extern void STOSW(cpu_t *cpu, instruction_t *i);
extern void LODSB(cpu_t *cpu, instruction_t *i);
extern void LODSW(cpu_t *cpu, instruction_t *i);

extern void JMP_Jv(cpu_t *cpu, instruction_t *i);
extern void JMP_Ap(cpu_t *cpu, instruction_t *i);
extern void JMP_Jb(cpu_t *cpu, instruction_t *i);
extern void JCC_Jb(cpu_t *cpu, instruction_t *i);
extern void CALL_Ap(cpu_t *cpu, instruction_t *i);
extern void CALL_Jv(cpu_t *cpu, instruction_t *i);
extern void RET_Iw(cpu_t *cpu, instruction_t *i);
extern void RETF_Iw(cpu_t *cpu, instruction_t *i);
extern void INT_Ib(cpu_t *cpu, instruction_t *i);
extern void RET(cpu_t *cpu, instruction_t *i);
extern void INT3(cpu_t *cpu, instruction_t *i);
extern void RETF(cpu_t *cpu, instruction_t *i);
extern void INTO(cpu_t *cpu, instruction_t *i);
extern void IRET(cpu_t *cpu, instruction_t *i);

extern void LOOP_Jb(cpu_t *cpu, instruction_t *i);
extern void JCXZ_Jb(cpu_t *cpu, instruction_t *i);
extern void LOOPZ_Jb(cpu_t *cpu, instruction_t *i);
extern void LOOPNZ_Jb(cpu_t *cpu, instruction_t *i);

extern void HLT(cpu_t *cpu, instruction_t *i);
extern void CLC(cpu_t *cpu, instruction_t *i);
extern void CMC(cpu_t *cpu, instruction_t *i);
extern void CLI(cpu_t *cpu, instruction_t *i);
extern void CLD(cpu_t *cpu, instruction_t *i);
extern void STC(cpu_t *cpu, instruction_t *i);
extern void STI(cpu_t *cpu, instruction_t *i);
extern void STD(cpu_t *cpu, instruction_t *i);
extern void NOP(cpu_t *cpu, instruction_t *i);

extern void GRP1_Eb_Ib(cpu_t *cpu, instruction_t *i);
extern void GRP1_Ev_Iv(cpu_t *cpu, instruction_t *i);
extern void GRP2_Eb_CL(cpu_t *cpu, instruction_t *i);
extern void GRP2_Ev_CL(cpu_t *cpu, instruction_t *i);
extern void GRP2_Eb(cpu_t *cpu, instruction_t *i);
extern void GRP2_Ev(cpu_t *cpu, instruction_t *i);
extern void GRP3_Eb(cpu_t *cpu, instruction_t *i);
extern void GRP3_Ev(cpu_t *cpu, instruction_t *i);
extern void GRP4_Eb(cpu_t *cpu, instruction_t *i);
extern void GRP5_Ev(cpu_t *cpu, instruction_t *i);

extern void IN_AL_Ib(cpu_t *cpu, instruction_t *i);
extern void IN_AX_Ib(cpu_t *cpu, instruction_t *i);
extern void IN_AL_DX(cpu_t *cpu, instruction_t *i);
extern void IN_AX_DX(cpu_t *cpu, instruction_t *i);
extern void OUT_Ib_AL(cpu_t *cpu, instruction_t *i);
extern void OUT_Ib_AX(cpu_t *cpu, instruction_t *i);
extern void OUT_DX_AL(cpu_t *cpu, instruction_t *i);
extern void OUT_DX_AX(cpu_t *cpu, instruction_t *i);

/**
 * illegal_opcode - if there is some error occur
 * call this function to exit
 */
void illegal_opcode(cpu_t *cpu, instruction_t *i)
{
	fprintf(stderr, "illegal opcode! opcode = 0x%X\n", i->opcode);
	exit(-1);
}

/**
 * unimplemented -
 */
void unimplemented(cpu_t *cpu, instruction_t *i)
{
	fprintf(stderr, "unimplemented opcode! opcode = 0x%X\n", i->opcode);
}

decode_t one_opcode_table[256] = {
/* 00 */ { ADD_Eb_Gb, HAS_MODRM },
/* 01 */ { ADD_Ev_Gv, HAS_MODRM },
/* 02 */ { ADD_Gb_Eb, HAS_MODRM },
/* 03 */ { ADD_Gv_Ev, HAS_MODRM },
/* 04 */ { ADD_AL_Ib, IMM_BYTE },
/* 05 */ { ADD_AX_Iv, IMM_WORD },
/* 06 */ { PUSH_ES, 0},
/* 07 */ { POP_ES, 0},
/* 08 */ { OR_Eb_Gb, HAS_MODRM },
/* 09 */ { OR_Ev_Gv, HAS_MODRM },
/* 0A */ { OR_Gb_Eb, HAS_MODRM },
/* 0B */ { OR_Gv_Ev, HAS_MODRM },
/* 0C */ { OR_AL_Ib, IMM_BYTE },
/* 0D */ { OR_AX_Iv, IMM_WORD },
/* 0E */ { PUSH_CS, 0},
/* 0F */ { illegal_opcode, 0 },
/* 10 */ { ADC_Eb_Gb, HAS_MODRM },
/* 11 */ { ADC_Ev_Gv, HAS_MODRM },
/* 12 */ { ADC_Gb_Eb, HAS_MODRM },
/* 13 */ { ADC_Gv_Ev, HAS_MODRM },
/* 14 */ { ADC_AL_Ib, IMM_BYTE },
/* 15 */ { ADC_AX_Iv, IMM_WORD },
/* 16 */ { PUSH_SS, 0},
/* 17 */ { POP_SS, 0},
/* 18 */ { SBB_Eb_Gb, HAS_MODRM },
/* 19 */ { SBB_Ev_Gv, HAS_MODRM },
/* 1A */ { SBB_Gb_Eb, HAS_MODRM },
/* 1B */ { SBB_Gv_Ev, HAS_MODRM },
/* 1C */ { SBB_AL_Ib, IMM_BYTE },
/* 1D */ { SBB_AX_Iv, IMM_WORD },
/* 1E */ { PUSH_DS, 0},
/* 1F */ { POP_DS, 0},
/* 20 */ { AND_Eb_Gb, HAS_MODRM },
/* 21 */ { AND_Ev_Gv, HAS_MODRM },
/* 22 */ { AND_Gb_Eb, HAS_MODRM },
/* 23 */ { AND_Gv_Ev, HAS_MODRM },
/* 24 */ { AND_AL_Ib, IMM_BYTE },
/* 25 */ { AND_AX_Iv, IMM_WORD },
/* 26 */ { illegal_opcode, 0},      // es prefix
/* 27 */ { DAA, 0},
/* 28 */ { SUB_Eb_Gb, HAS_MODRM },
/* 29 */ { SUB_Ev_Gv, HAS_MODRM },
/* 2A */ { SUB_Gb_Eb, HAS_MODRM },
/* 2B */ { SUB_Gv_Ev, HAS_MODRM },
/* 2C */ { SUB_AL_Ib, IMM_BYTE },
/* 2D */ { SUB_AX_Iv, IMM_WORD },
/* 2E */ { illegal_opcode, 0},      // cs prefix
/* 2F */ { DAS, 0},
/* 30 */ { XOR_Eb_Gb, HAS_MODRM },
/* 31 */ { XOR_Ev_Gv, HAS_MODRM },
/* 32 */ { XOR_Gb_Eb, HAS_MODRM },
/* 33 */ { XOR_Gv_Ev, HAS_MODRM },
/* 34 */ { XOR_AL_Ib, IMM_BYTE },
/* 35 */ { XOR_AX_Iv, IMM_WORD },
/* 36 */ { illegal_opcode, 0},      // ss prefix
/* 37 */ { AAA, 0},
/* 38 */ { CMP_Eb_Gb, HAS_MODRM },
/* 39 */ { CMP_Ev_Gv, HAS_MODRM },
/* 3A */ { CMP_Gb_Eb, HAS_MODRM },
/* 3B */ { CMP_Gv_Ev, HAS_MODRM },
/* 3C */ { CMP_AL_Ib, IMM_BYTE },
/* 3D */ { CMP_AX_Iv, IMM_WORD },
/* 3E */ { illegal_opcode, 0},      // ds prefix
/* 3F */ { AAS, 0},
/* 40 */ { INC_RX, 0},
/* 41 */ { INC_RX, 0},
/* 42 */ { INC_RX, 0},
/* 43 */ { INC_RX, 0},
/* 44 */ { INC_RX, 0},
/* 45 */ { INC_RX, 0},
/* 46 */ { INC_RX, 0},
/* 47 */ { INC_RX, 0},
/* 48 */ { DEC_RX, 0},
/* 49 */ { DEC_RX, 0},
/* 4A */ { DEC_RX, 0},
/* 4B */ { DEC_RX, 0},
/* 4C */ { DEC_RX, 0},
/* 4D */ { DEC_RX, 0},
/* 4E */ { DEC_RX, 0},
/* 4F */ { DEC_RX, 0},
/* 50 */ { PUSH_RX, 0},
/* 51 */ { PUSH_RX, 0},
/* 52 */ { PUSH_RX, 0},
/* 53 */ { PUSH_RX, 0},
/* 54 */ { PUSH_RX, 0},
/* 55 */ { PUSH_RX, 0},
/* 56 */ { PUSH_RX, 0},
/* 57 */ { PUSH_RX, 0},
/* 58 */ { POP_RX, 0},
/* 59 */ { POP_RX, 0},
/* 5A */ { POP_RX, 0},
/* 5B */ { POP_RX, 0},
/* 5C */ { POP_RX, 0},
/* 5D */ { POP_RX, 0},
/* 5E */ { POP_RX, 0},
/* 5F */ { POP_RX, 0},
/* 60 */ { illegal_opcode, 0},
/* 61 */ { illegal_opcode, 0},
/* 62 */ { illegal_opcode, 0},
/* 63 */ { illegal_opcode, 0},
/* 64 */ { illegal_opcode, 0},
/* 65 */ { illegal_opcode, 0},
/* 66 */ { illegal_opcode, 0},
/* 67 */ { illegal_opcode, 0},
/* 68 */ { illegal_opcode, 0},
/* 69 */ { illegal_opcode, 0},
/* 6A */ { illegal_opcode, 0},
/* 6B */ { illegal_opcode, 0},
/* 6C */ { illegal_opcode, 0},
/* 6D */ { illegal_opcode, 0},
/* 6E */ { illegal_opcode, 0},
/* 6F */ { illegal_opcode, 0},
/* 70 */ { JCC_Jb, IMM_BYTE },
/* 71 */ { JCC_Jb, IMM_BYTE },
/* 72 */ { JCC_Jb, IMM_BYTE },
/* 73 */ { JCC_Jb, IMM_BYTE },
/* 74 */ { JCC_Jb, IMM_BYTE },
/* 75 */ { JCC_Jb, IMM_BYTE },
/* 76 */ { JCC_Jb, IMM_BYTE },
/* 77 */ { JCC_Jb, IMM_BYTE },
/* 78 */ { JCC_Jb, IMM_BYTE },
/* 79 */ { JCC_Jb, IMM_BYTE },
/* 7A */ { JCC_Jb, IMM_BYTE },
/* 7B */ { JCC_Jb, IMM_BYTE },
/* 7C */ { JCC_Jb, IMM_BYTE },
/* 7D */ { JCC_Jb, IMM_BYTE },
/* 7E */ { JCC_Jb, IMM_BYTE },
/* 7F */ { JCC_Jb, IMM_BYTE },
/* 80 */ { GRP1_Eb_Ib, HAS_MODRM|IMM_BYTE },
/* 81 */ { GRP1_Ev_Iv, HAS_MODRM|IMM_WORD },
/* 82 */ { GRP1_Eb_Ib, HAS_MODRM|IMM_BYTE },
/* 83 */ { GRP1_Ev_Iv, HAS_MODRM|IMM_BYTE },
/* 84 */ { TEST_Gb_Eb, HAS_MODRM },
/* 85 */ { TEST_Gv_Ev, HAS_MODRM },
/* 86 */ { XCHG_Gb_Eb, HAS_MODRM },
/* 87 */ { XCHG_Gv_Ev, HAS_MODRM },
/* 88 */ { MOV_Eb_Gb, HAS_MODRM },
/* 89 */ { MOV_Ev_Gv, HAS_MODRM },
/* 8A */ { MOV_Gb_Eb, HAS_MODRM },
/* 8B */ { MOV_Gv_Ev, HAS_MODRM },
/* 8C */ { MOV_Ew_Sw, HAS_MODRM },
/* 8D */ { LEA_Gv_Mv, HAS_MODRM },
/* 8E */ { MOV_Sw_Ew, HAS_MODRM },
/* 8F */ { POP_Ev, HAS_MODRM },
/* 90 */ { NOP, 0},
/* 91 */ { XCHG_RX_AX, 0},
/* 92 */ { XCHG_RX_AX, 0},
/* 93 */ { XCHG_RX_AX, 0},
/* 94 */ { XCHG_RX_AX, 0},
/* 95 */ { XCHG_RX_AX, 0},
/* 96 */ { XCHG_RX_AX, 0},
/* 97 */ { XCHG_RX_AX, 0},
/* 98 */ { CBW, 0},
/* 99 */ { CWD, 0},
/* 9A */ { CALL_Ap, IMM_DWORD },
/* 9B */ { WAIT, 0},
/* 9C */ { PUSHF, 0},
/* 9D */ { POPF, 0},
/* 9E */ { SAHF, 0},
/* 9F */ { LAHF, 0},
/* A0 */ { MOV_AL_Ob, IMM_WORD},
/* A1 */ { MOV_AX_Ov, IMM_WORD},
/* A2 */ { MOV_Ob_AL, IMM_WORD},
/* A3 */ { MOV_Ov_AX, IMM_WORD},
/* A4 */ { MOVSB, 0},
/* A5 */ { MOVSW, 0},
/* A6 */ { CMPSB, 0},
/* A7 */ { CMPSW, 0},
/* A8 */ { TEST_AL_Ib, IMM_BYTE },
/* A9 */ { TEST_AX_Iv, IMM_WORD },
/* AA */ { STOSB, 0},
/* AB */ { STOSW, 0},
/* AC */ { LODSB, 0},
/* AD */ { LODSW, 0},
/* AE */ { SCASB, 0},
/* AF */ { SCASW, 0},
/* B0 */ { MOV_RL_Ib, IMM_BYTE },
/* B1 */ { MOV_RL_Ib, IMM_BYTE },
/* B2 */ { MOV_RL_Ib, IMM_BYTE },
/* B3 */ { MOV_RL_Ib, IMM_BYTE },
/* B4 */ { MOV_RL_Ib, IMM_BYTE },
/* B5 */ { MOV_RL_Ib, IMM_BYTE },
/* B6 */ { MOV_RL_Ib, IMM_BYTE },
/* B7 */ { MOV_RL_Ib, IMM_BYTE },
/* B8 */ { MOV_RX_Iv, IMM_WORD },
/* B9 */ { MOV_RX_Iv, IMM_WORD },
/* BA */ { MOV_RX_Iv, IMM_WORD },
/* BB */ { MOV_RX_Iv, IMM_WORD },
/* BC */ { MOV_RX_Iv, IMM_WORD },
/* BD */ { MOV_RX_Iv, IMM_WORD },
/* BE */ { MOV_RX_Iv, IMM_WORD },
/* BF */ { MOV_RX_Iv, IMM_WORD },
/* C0 */ { GRP2_Eb, HAS_MODRM|IMM_BYTE },
/* C1 */ { GRP2_Ev, HAS_MODRM|IMM_BYTE },
/* C2 */ { RET_Iw,  IMM_WORD },
/* C3 */ { RET, 0},
/* C4 */ { LES_Gv_Mp, HAS_MODRM },
/* C5 */ { LDS_Gv_Mp, HAS_MODRM },
/* C6 */ { MOV_Eb_Ib, HAS_MODRM|IMM_BYTE },
/* C7 */ { MOV_Ev_Iv, HAS_MODRM|IMM_WORD },
/* C8 */ { illegal_opcode, 0},
/* C9 */ { illegal_opcode, 0},
/* CA */ { RETF_Iw, IMM_WORD },
/* CB */ { RETF, 0},
/* CC */ { INT3, 0},
/* CD */ { INT_Ib, IMM_BYTE },
/* CE */ { INTO, 0},
/* CF */ { IRET, 0},
/* D0 */ { GRP2_Eb, HAS_MODRM },
/* D1 */ { GRP2_Ev, HAS_MODRM },
/* D2 */ { GRP2_Eb_CL, HAS_MODRM },
/* D3 */ { GRP2_Ev_CL, HAS_MODRM },
/* D4 */ { AAM_Ib, IMM_BYTE },
/* D5 */ { AAD_Ib, IMM_BYTE },
/* D6 */ { illegal_opcode, 0},
/* D7 */ { XLAT, 0},
/* D8 */ { illegal_opcode, 0},
/* D9 */ { illegal_opcode, 0},
/* DA */ { illegal_opcode, 0},
/* DB */ { illegal_opcode, 0},
/* DC */ { illegal_opcode, 0},
/* DD */ { illegal_opcode, 0},
/* DE */ { illegal_opcode, 0},
/* DF */ { illegal_opcode, 0},
/* E0 */ { LOOPNZ_Jb, IMM_BYTE },
/* E1 */ { LOOPNZ_Jb, IMM_BYTE },
/* E2 */ { LOOP_Jb, IMM_BYTE },
/* E3 */ { JCXZ_Jb, IMM_BYTE },
/* E4 */ { IN_AL_Ib, IMM_BYTE },
/* E5 */ { IN_AX_Ib, IMM_BYTE },
/* E6 */ { OUT_Ib_AL, IMM_BYTE },
/* E7 */ { OUT_Ib_AX, IMM_BYTE },
/* E8 */ { CALL_Jv, IMM_WORD },
/* E9 */ { JMP_Jv, IMM_WORD },
/* EA */ { JMP_Ap, IMM_DWORD },
/* EB */ { JMP_Jb, IMM_BYTE },
/* EC */ { IN_AL_DX, 0},
/* ED */ { IN_AX_DX, 0},
/* EE */ { OUT_DX_AL, 0},
/* EF */ { OUT_DX_AX, 0},
/* F0 */ { illegal_opcode, 0},   // LOCK  prefix
/* F1 */ { illegal_opcode, 0},
/* F2 */ { illegal_opcode, 0},   // REPNZ prefix
/* F3 */ { illegal_opcode, 0},   // REPZ  prefix
/* F4 */ { HLT, 0},
/* F5 */ { CMC, 0},
/* F6 */ { GRP3_Eb, HAS_MODRM|GRP_BYTE },
/* F7 */ { GRP3_Ev, HAS_MODRM|GRP_WORD },
/* F8 */ { CLC, 0},
/* F9 */ { STC, 0},
/* FA */ { CLI, 0},
/* FB */ { STI, 0},
/* FC */ { CLD, 0},
/* FD */ { STD, 0},
/* FE */ { GRP4_Eb, HAS_MODRM },
/* FF */ { GRP5_Ev, HAS_MODRM },
};

decode_t two_opcode_table[256] = {{NULL, 0},};
